#pragma once
#ifndef SPA_TYPES_H
#define SPA_TYPES_H

#include <string>
#include <set>
//#include "TNode.h" // defined in AST.h

using namespace std;

enum NodeType { 
	/*
	  The following represents the elements of the SIMPLE language.
	   _NULL represents is an invalid type.
	*/
	PROCEDURE, 
	STMTLST, 
	ASSIGN, 
	WHILE, 
	PLUS, 
	MINUS,
	TIMES,  
	DIVIDE, 
	VARIABLE, 
	CONSTANT,
	CALL,
	IF,
	_NULL
};

struct Statement {
	NodeType node_type;
	int statement_number; 
	
	/* Custom comparator for Map:
		http://www.daniweb.com/software-development/cpp/threads/173285
	*/
	bool operator<(const Statement& s) const { 
		return statement_number < s.statement_number; 
	}
	
	bool operator==(const Statement s) const {
		return (statement_number == s.statement_number) && 
			(node_type == s.node_type);
	}
};

typedef int VARINDEX;
typedef int PROCINDEX;

typedef int INTEGER;
typedef bool BOOLEAN;
typedef std::string STRING;

typedef Statement STMT;

typedef enum NodeType NODETYPE;
//typedef TNode TNODE; // defined in AST.h

typedef set<int> VARINDEX_ARRAY;
typedef set<int> PROCINDEX_ARRAY;
typedef set<Statement> STMT_ARRAY;
typedef set<STRING> STRING_ARRAY;
typedef set<int> INTEGER_ARRAY;
typedef int PROG_LINE;
typedef set<int> PROG_LINE_ARRAY;
#endif